﻿$(function () {
    $orderStatusLi = $(".orderstuts ul li");

    IsShowOrder();

    $orderStatusLi.click(function () {
        $(this).addClass("orderstutsselected").siblings().removeClass("orderstutsselected");
        $(this).children().children().addClass("orderstutsnumbg").siblings().removeClass("orderstutsnumbg");
        var liIndex = $(this).index();
        $("[id$=hidStr]").val(liIndex);
        $("#aspnetForm").submit();

    }).hover(function () {
        $(this).addClass("orderstuts_selected");
        $(this).children().children().addClass("orderstuts_numbg");
    }, function () {
        $(this).removeClass("orderstuts_selected");
        $(this).children().children().removeClass("orderstuts_numbg");
    });

    $("#showEvaluate span").click(function () {
        var spanIndex = $(this).index();
        switch (spanIndex) {
            case 0:
                $("[id$=hidStr]").val(8);   //未评价
                break;
            case 1:
                $("[id$=hidStr]").val(9);   //已评价
                break;
            case 2:
                $("[id$=hidStr]").val(10);   //已互评
                break;
            default:
                $("[id$=hidStr]").val(3);
        }       
        $("#aspnetForm").submit();
    });

    $("#showClosed span").click(function () {
        var spanIndex = $(this).index();
        switch (spanIndex) {
            case 0:
                $("[id$=hidStr]").val(15);   //已关闭
                break;
            case 1:
                $("[id$=hidStr]").val(16);   //买家请求关闭
                break;
            case 2:
                $("[id$=hidStr]").val(17);   //卖家请求关闭
                break;
            default:
                $("[id$=hidStr]").val(4);
        }      
        $("#aspnetForm").submit();
    });

});

function IsShowOrder() {
    var liIndex = $("[id$=hidStr]").val();
    var spanIndex = $("[id$=hidStr]").val();    
    switch (liIndex) {
        case "0":
            $("#showEvaluate").hide();
            break;
        case "1":
            $("#showEvaluate").hide();
            break;
        case "2":
            $("#showEvaluate").hide();
            break;
        case "3":
            $("#showEvaluate").show();
            break;
        case "4":
            $("#showClosed").show();
            break;
        case "8":
            $("#showEvaluate span").eq(0).addClass("orderevaluateselect").siblings().removeClass("orderevaluateselect");        
            $("#showEvaluate").show();
            liIndex = 3;
            break;
        case "9":
            $("#showEvaluate span").eq(1).addClass("orderevaluateselect").siblings().removeClass("orderevaluateselect");
            $("#showEvaluate").show();
            liIndex = 3;
            break;
        case "10":
            $("#showEvaluate span").eq(2).addClass("orderevaluateselect").siblings().removeClass("orderevaluateselect");
            $("#showEvaluate").show();
            liIndex = 3;
            break;
        case "15":
            $("#showClosed span").eq(0).addClass("orderevaluateselect").siblings().removeClass("orderevaluateselect");
            $("#showClosed").show();
            liIndex = 4;
            break;
        case "16":
            $("#showClosed span").eq(1).addClass("orderevaluateselect").siblings().removeClass("orderevaluateselect");
            $("#showClosed").show();
            liIndex = 4;
            break;
        case "17":
            $("#showClosed span").eq(2).addClass("orderevaluateselect").siblings().removeClass("orderevaluateselect");
            $("#showClosed").show();
            liIndex = 4;
            break;
        default:
            liIndex = 0;
            break;
    }
    $orderStatusLi.eq(liIndex).addClass("orderstutsselected").siblings().removeClass("orderstutsselected");
    $orderStatusLi.eq(liIndex).children().children().addClass("orderstutsnumbg").siblings().removeClass("orderstutsnumbg");
}